{
  "properties" : { },
  "id" : "f7d2fc76c0034060bcb09d89da4c34e8",
  "script" : null,
  "groupId" : "4f0230049d7e4f39b1e0897cc0f46f9a",
  "name" : "导入",
  "createTime" : null,
  "updateTime" : 1651932628342,
  "lock" : null,
  "createBy" : null,
  "updateBy" : null,
  "path" : "/import",
  "method" : "POST",
  "parameters" : [ ],
  "options" : [ {
    "name" : "permission",
    "value" : "user:import",
    "description" : "允许拥有该权限的访问",
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  } ],
  "requestBody" : "{\r\n    \"datas\": [{\"登录名称\":\"test1\",\"密码\":1,\"姓名/昵称\":\"test1\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393296},{\"登录名称\":\"test2\",\"密码\":2,\"姓名/昵称\":\"test2\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393297},{\"登录名称\":\"test3\",\"密码\":3,\"姓名/昵称\":\"test3\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393298},{\"登录名称\":\"test4\",\"密码\":4,\"姓名/昵称\":\"test4\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393299},{\"登录名称\":\"test5\",\"密码\":5,\"姓名/昵称\":\"test5\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393300},{\"登录名称\":\"test6\",\"密码\":6,\"姓名/昵称\":\"test6\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393301},{\"登录名称\":\"test7\",\"密码\":7,\"姓名/昵称\":\"test7\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393302},{\"登录名称\":\"test8\",\"密码\":8,\"姓名/昵称\":\"test8\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393303},{\"登录名称\":\"test9\",\"密码\":9,\"姓名/昵称\":\"test9\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393304},{\"登录名称\":\"test10\",\"密码\":10,\"姓名/昵称\":\"test10\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393305},{\"登录名称\":\"test11\",\"密码\":11,\"姓名/昵称\":\"test11\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393306},{\"登录名称\":\"test12\",\"密码\":12,\"姓名/昵称\":\"test12\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393307},{\"登录名称\":\"test13\",\"密码\":13,\"姓名/昵称\":\"test13\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393308},{\"登录名称\":\"test14\",\"密码\":14,\"姓名/昵称\":\"test14\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393309},{\"登录名称\":\"test15\",\"密码\":15,\"姓名/昵称\":\"test15\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393310},{\"登录名称\":\"test16\",\"密码\":16,\"姓名/昵称\":\"test16\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393311},{\"登录名称\":\"test17\",\"密码\":17,\"姓名/昵称\":\"test17\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393312},{\"登录名称\":\"test18\",\"密码\":18,\"姓名/昵称\":\"test18\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393313},{\"登录名称\":\"test19\",\"密码\":19,\"姓名/昵称\":\"test19\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393314},{\"登录名称\":\"test20\",\"密码\":20,\"姓名/昵称\":\"test20\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393315},{\"登录名称\":\"test21\",\"密码\":21,\"姓名/昵称\":\"test21\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393316},{\"登录名称\":\"test22\",\"密码\":22,\"姓名/昵称\":\"test22\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393317},{\"登录名称\":\"test23\",\"密码\":23,\"姓名/昵称\":\"test23\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393318},{\"登录名称\":\"test24\",\"密码\":24,\"姓名/昵称\":\"test24\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393319},{\"登录名称\":\"test25\",\"密码\":25,\"姓名/昵称\":\"test25\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393320},{\"登录名称\":\"test26\",\"密码\":26,\"姓名/昵称\":\"test26\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393321},{\"登录名称\":\"test27\",\"密码\":27,\"姓名/昵称\":\"test27\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393322},{\"登录名称\":\"test28\",\"密码\":28,\"姓名/昵称\":\"test28\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393323},{\"登录名称\":\"test29\",\"密码\":29,\"姓名/昵称\":\"test29\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393324},{\"登录名称\":\"test30\",\"密码\":30,\"姓名/昵称\":\"test30\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393325},{\"登录名称\":\"test31\",\"密码\":31,\"姓名/昵称\":\"test31\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393326},{\"登录名称\":\"test32\",\"密码\":32,\"姓名/昵称\":\"test32\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393327},{\"登录名称\":\"test33\",\"密码\":33,\"姓名/昵称\":\"test33\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393328},{\"登录名称\":\"test34\",\"密码\":34,\"姓名/昵称\":\"test34\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393329},{\"登录名称\":\"test35\",\"密码\":35,\"姓名/昵称\":\"test35\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393330},{\"登录名称\":\"test36\",\"密码\":36,\"姓名/昵称\":\"test36\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393331},{\"登录名称\":\"test37\",\"密码\":37,\"姓名/昵称\":\"test37\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393332},{\"登录名称\":\"test38\",\"密码\":38,\"姓名/昵称\":\"test38\",\"所属机构（编码）\":\"mxd\",\"角色（编码）\":\"admin\",\"手机号\":15300393333}]\r\n}",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"code\": 0,\n    \"message\": \"登录名称已存在\",\n    \"data\": null,\n    \"timestamp\": 1648866276963,\n    \"executeTime\": 21\n}",
  "description" : null,
  "requestBodyDefinition" : {
    "name" : "",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "Object",
    "type" : null,
    "defaultValue" : null,
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "datas",
      "value" : "",
      "description" : "",
      "required" : false,
      "dataType" : "Array",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ {
        "name" : "",
        "value" : "",
        "description" : "",
        "required" : false,
        "dataType" : "Object",
        "type" : null,
        "defaultValue" : null,
        "validateType" : "",
        "error" : "",
        "expression" : "",
        "children" : [ {
          "name" : "登录名称",
          "value" : "test1",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "密码",
          "value" : "1",
          "description" : "",
          "required" : false,
          "dataType" : "Integer",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "姓名/昵称",
          "value" : "test1",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "所属机构（编码）",
          "value" : "mxd",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "角色（编码）",
          "value" : "admin",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "手机号",
          "value" : "15300393296",
          "description" : "",
          "required" : false,
          "dataType" : "Long",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        } ]
      } ]
    } ]
  },
  "responseBodyDefinition" : {
    "name" : "",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "Object",
    "type" : null,
    "defaultValue" : null,
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "code",
      "value" : "0",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "message",
      "value" : "登录名称已存在",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "data",
      "value" : "null",
      "description" : "",
      "required" : false,
      "dataType" : "Object",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "timestamp",
      "value" : "1648866276963",
      "description" : "",
      "required" : false,
      "dataType" : "Long",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "executeTime",
      "value" : "21",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    } ]
  }
}
================================
import "@post:/system/user/save" as userSave;
import log

body.datas.each(data => {
    var username
    var name
    var password
    var phone
    var officeId
    var roles
    var i = 0
    data.each((key, value) => {
        log.info(i + '')
        if(i == 0){
            username = value
        }
        if(i == 1){
            password = value + ''
        }
        if(i == 2){
            name = value
        }
        if(i == 3){
            officeId = db.selectValue("""
                select id from sys_office where is_del = 0 and code = #{value}
            """)
            log.info(officeId)
        }
        if(i == 4){
            roles = db.selectValue("""
                select id from sys_role where is_del = 0 and code = #{value}
            """)
            log.info(roles)
        }
        if(i == 5){
            phone = value
        }
        i++
    })
    userSave()

})
return 1